# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.IdentityToolkit.V3.Model.IdentitytoolkitRelyingpartyVerifyAssertionRequest do
  @moduledoc """
  Request to verify the IDP assertion.

  ## Attributes

  *   `autoCreate` (*type:* `boolean()`, *default:* `nil`) - When it's true, automatically creates a new account if the user doesn't exist. When it's false, allows existing user to sign in normally and throws exception if the user doesn't exist.
  *   `delegatedProjectNumber` (*type:* `String.t`, *default:* `nil`) - GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration.
  *   `idToken` (*type:* `String.t`, *default:* `nil`) - The GITKit token of the authenticated user.
  *   `instanceId` (*type:* `String.t`, *default:* `nil`) - Instance id token of the app.
  *   `pendingIdToken` (*type:* `String.t`, *default:* `nil`) - The GITKit token for the non-trusted IDP pending to be confirmed by the user.
  *   `postBody` (*type:* `String.t`, *default:* `nil`) - The post body if the request is a HTTP POST.
  *   `requestUri` (*type:* `String.t`, *default:* `nil`) - The URI to which the IDP redirects the user back. It may contain federated login result params added by the IDP.
  *   `returnIdpCredential` (*type:* `boolean()`, *default:* `nil`) - Whether return 200 and IDP credential rather than throw exception when federated id is already linked.
  *   `returnRefreshToken` (*type:* `boolean()`, *default:* `nil`) - Whether to return refresh tokens.
  *   `returnSecureToken` (*type:* `boolean()`, *default:* `nil`) - Whether return sts id token and refresh token instead of gitkit token.
  *   `sessionId` (*type:* `String.t`, *default:* `nil`) - Session ID, which should match the one in previous createAuthUri request.
  *   `tenantId` (*type:* `String.t`, *default:* `nil`) - For multi-tenant use cases, in order to construct sign-in URL with the correct IDP parameters, Firebear needs to know which Tenant to retrieve IDP configs from.
  *   `tenantProjectNumber` (*type:* `String.t`, *default:* `nil`) - Tenant project number to be used for idp discovery.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :autoCreate => boolean() | nil,
          :delegatedProjectNumber => String.t() | nil,
          :idToken => String.t() | nil,
          :instanceId => String.t() | nil,
          :pendingIdToken => String.t() | nil,
          :postBody => String.t() | nil,
          :requestUri => String.t() | nil,
          :returnIdpCredential => boolean() | nil,
          :returnRefreshToken => boolean() | nil,
          :returnSecureToken => boolean() | nil,
          :sessionId => String.t() | nil,
          :tenantId => String.t() | nil,
          :tenantProjectNumber => String.t() | nil
        }

  field(:autoCreate)
  field(:delegatedProjectNumber)
  field(:idToken)
  field(:instanceId)
  field(:pendingIdToken)
  field(:postBody)
  field(:requestUri)
  field(:returnIdpCredential)
  field(:returnRefreshToken)
  field(:returnSecureToken)
  field(:sessionId)
  field(:tenantId)
  field(:tenantProjectNumber)
end

defimpl Poison.Decoder,
  for: GoogleApi.IdentityToolkit.V3.Model.IdentitytoolkitRelyingpartyVerifyAssertionRequest do
  def decode(value, options) do
    GoogleApi.IdentityToolkit.V3.Model.IdentitytoolkitRelyingpartyVerifyAssertionRequest.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.IdentityToolkit.V3.Model.IdentitytoolkitRelyingpartyVerifyAssertionRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
